package net.wofly.cashier.order.util;


/**
 * 支付类型
 *
 * @author lign
 * @version 1.0
 * @created 17-10月-2017 21:57:12
 */
public enum PayType {
    现金(1, "现金"),
    支付宝(2, "支付宝"),
    微信支付(3, "微信支付"),
    货到付款(4, "货到付款"),
    白条支付(5, "白条支付"),
    签单(6, "签单"),
    支付定金(9, "支付定金");
    
    private Integer value;
    private String name;
    
    private PayType(Integer value, String name) {
        this.value = value;
        this.name = name;
    }
    
    public static boolean isValueCorrect(Integer value) {
        for (PayType forEnum : values()) {
            if (value == forEnum.getValue().intValue()) {
                return true;
            }
        }
        return false;
    }
    
    public static String getName(Integer value) {
        for (PayType forEnum : values()) {
            if (value.equals(forEnum.getValue())) {
                return forEnum.name;
            }
        }
        return null;
    }
    
    public String getName() {
        return name;
    }
    
    public void setName(String name) {
        this.name = name;
    }
    
    public Integer getValue() {
        return value;
    }
    
    public void setValue(Integer value) {
        this.value = value;
    }
}